import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'
import Iloveyou from '@/views/layout/Iloveyou'


export const constantRouterMap = [
  { path: '/login', component: () => import('@/views/login/index'), hidden: true },
  { path: '/404', component: () => import('@/views/404'), hidden: true },

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    name: 'Dashboard',
    hidden: true,
    children: [{
      path: 'dashboard',
      component: () => import('@/views/dashboard/index')
    }]
  },

  {
    path: '/merchant',
    component: Layout,
    redirect: '/merchant/table',
    name: '比赛供应商',
    meta: { title: '比赛供应商', icon: 'example' },
    children: [
      {
        path: 'table',
        name: '供应商列表',
        component: () => import('@/views/merchant/list'),
        meta: { title: '供应商列表', icon: 'table' }
      },
      {
        path: 'save',
        name: '添加供应商',
        component: () => import('@/views/merchant/save'),
        meta: { title: '添加供应商', icon: 'tree' }
      },
      {
        path: 'edit/:id',
        name: '修改供应商',
        component: () => import('@/views/merchant/save'),
        meta: { title: '修改供应商', icon: 'tree' },
        hidden: true
      },
    ]
  },

  {
    path: '/contest',
    component: Layout,
    children: [
      {
      path: 'save',
      name: '开启一场比赛',
      component: () => import('@/views/contest/conteststart'),
      meta: { title: '开启一场比赛', icon: 'user' }
      }
    ]
  },

  {
    path: '/getcontest',
    component: Layout,
    children: [
      {
      path: 'list',
      name: '查看比赛列表',
      component: () => import('@/views/contest/contestlist'),
      meta: { title: '查看比赛列表', icon: 'user' }
      }
    ]
  },

  {
    path: '/log',
    component: Layout,
    children: [
      {
      path: 'contestlogin',
      name: '比赛登录页面',
      component: () => import('@/views/login/contestlogin'),
      meta: { title: '比赛登录页面(新)', icon: 'user' }
      }
    ]
  },

  {
    path: '/register',
    component: Layout,
    children: [
      {
      path: 'contestregister',
      name: '比赛注册页面',
      component: () => import('@/views/login/contestregister'),
      meta: { title: '比赛注册页面(新)', icon: 'user' }
      }
    ]
  },

  {
    path: '/admin',
    component: Iloveyou,
    children: [
      {
      path: 'index',
      name: '主首页(新)',
      component: () => import('@/views/index/index'),
      meta: { title: '主首页(新)', icon: 'user' }
      },
      {
        path: 'registration',
        name: '参加报名',
        component: () => import('@/views/index/registration'),
        meta: { title: '参加报名', icon: 'user' },
        hidden: true
      },
      {
        path: 'schedule',
        name: '赛程信息',
        component: () => import('@/views/index/schedule'),
        meta: { title: '赛程信息', icon: 'user' },
        hidden: true
      },
      {
        path: 'comment',
        name: '评论区',
        component: () => import('@/views/index/comment'),
        meta: { title: '评论区', icon: 'user' },
        hidden: true
      },
      {
        path: 'honor',
        name: '个人荣誉',
        component: () => import('@/views/index/honor'),
        meta: { title: '个人荣誉', icon: 'user' },
        hidden: true
      },
      {
        path: 'info',
        name: '个人信息',
        component: () => import('@/views/index/info'),
        meta: { title: '个人信息', icon: 'user' },
        hidden: true
      },
      {
        path: 'author',
        name: '联系作者',
        component: () => import('@/views/index/author'),
        meta: { title: '联系作者', icon: 'user' },
        hidden: true
      }
    ]
  },

  { path: '*', redirect: '/404', hidden: true }
]

const router = new Router({
  mode: 'history',
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})

export default router ;
